import time

from Po_kaoshi.Podemo.Base import Base
from selenium.webdriver.common.by import By
class Page(Base):

    # 定位器

    xuesheng_loc=(By.XPATH,'/html/body/div[1]/div/section/section/main/form/div[1]/div/div[1]/div/input')

    laoshi_loc=(By.XPATH,'/html/body/div[1]/div/section/section/main/form/div[2]/div/div[1]/div/input')

    kecheng_loc=(By.XPATH,'/html/body/div[1]/div/section/section/main/form/div[3]/div/div[1]/div/input')

    caozuo_loc=(By.XPATH,'/html/body/div[1]/div/section/section/main/form/div[6]/div/div[1]/div/input')

    tijiao_loc=(By.XPATH,'/html/body/div[1]/div/section/section/main/form/div[7]/div/button[1]/span')


    # 封装元素定位
    def xuesheng(self):
        self.send_keys(self.xuesheng_loc,'李一驰')

    def laoshi(self):
        self.send_keys(self.laoshi_loc,'白老师')

    def kecheng(self):
        self.send_keys(self.kecheng_loc,'web自动化')

    def caozuo(self):
        self.send_keys(self.caozuo_loc,'吴老师')

    def tijia(self):
        self.click(self.tijiao_loc)

    # 业务逻辑

    def luoji_yewu(self):
        self.open_url('http://localhost:8080/additem')
        time.sleep(2)
        self.xuesheng()
        time.sleep(2)
        self.laoshi()
        time.sleep(2)
        self.kecheng()
        time.sleep(2)
        self.caozuo()
        time.sleep(2)
        duanyan01=(By.XPATH,'/html/body/div[1]/div/section/section/main/form/div[7]/div/button[2]/span').test
        self.tijia()
        time.sleep(2)